//
//  HXTCardInfoVC.m
//  掌上宏力
//
//  Created by admin on 2017/5/22.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "HXTCardInfoVC.h"
#import "CardInfoModel.h"
#import "HXTInfoViewModel.h"

static CGFloat Lab_H = 40;
static CGFloat Lab_W = 300;

@interface HXTCardInfoVC ()

@property (nonatomic,strong) CardInfoModel *cardInfo;
@property (nonatomic,strong) HXTInfoViewModel *viewModel;


@end

@implementation HXTCardInfoVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"持卡人信息";
    [SVProgressHUD showWithStatus:@"正在加载..."];
    [self getCardInfo];
}

-(void)getCardInfo{
    _viewModel = [[HXTInfoViewModel alloc] init];
    [_viewModel getHXTCardsInfo:^{
        _cardInfo = _viewModel.cardInfo;
        [self createInfoView];
        [SVProgressHUD dismiss];
    }];
}

-(void)createInfoView{
    NSString *nameStr = [NSString stringWithFormat:@"姓       名：%@",self.cardInfo.name];
    UILabel *nameL = [Factory createLabelWithTitle:nameStr frame:CGRectMake(LeftDis, 5, 150, Lab_H) fontSize:16];
    
    [self.view addSubview:nameL];
    
    NSString *sexStr = [NSString stringWithFormat:@"性        别：%@",self.cardInfo.sex];
    UILabel *sexL = [Factory createLabelWithTitle:sexStr frame:CGRectMake(LeftDis, nameL.bottom, 150, Lab_H) fontSize:16];
    [self.view addSubview:sexL];
    
    NSString *phoneStr = [NSString stringWithFormat:@"电        话：%@",self.cardInfo.phone];
    UILabel *phoneL = [Factory createLabelWithTitle:phoneStr frame:CGRectMake(LeftDis, sexL.bottom, Lab_W, Lab_H) fontSize:16];
    [self.view addSubview:phoneL];
    
    NSString *cardIdStr = [NSString stringWithFormat:@"身份证号：%@",self.cardInfo.idNo];
    UILabel *cardIdL = [Factory createLabelWithTitle:cardIdStr frame:CGRectMake(LeftDis, phoneL.bottom, Lab_W, Lab_H) fontSize:16];
    [self.view addSubview:cardIdL];
    
    NSString *hxtCardNoStr = [NSString stringWithFormat:@"卡        号：%@",self.cardInfo.HxtCardNo];
    UILabel *cardNoL = [Factory createLabelWithTitle:hxtCardNoStr frame:CGRectMake(LeftDis, cardIdL.bottom, Lab_W, Lab_H) fontSize:16];
    [self.view addSubview:cardNoL];
    
    NSString *cardTypeStr = [NSString stringWithFormat:@"类        型：%@",self.cardInfo.cardType];
    UILabel *cardTypeL = [Factory createLabelWithTitle:cardTypeStr frame:CGRectMake(LeftDis, cardNoL.bottom, Lab_W, Lab_H) fontSize:16];
    [self.view addSubview:cardTypeL];
}


@end
